package com.xy.common.util;

/**
 * @author xiao.yi
 * @date 2023/9/28 14:18
 */
public class UserDevice {
    private String ua;
    private String userEnv;
    private String device;
    private String deviceType;
    private String deviceVersion;
    private String browser;
    private Boolean mobile;

    public UserDevice() {
    }

    public UserDevice(String ua) {
        this.setUa(ua);
    }

    public UserDevice(String userEnv, String deviceType, String deviceVersion, Boolean isMobile) {
        this.userEnv = userEnv;
        this.deviceType = deviceType;
        this.deviceVersion = deviceVersion;
        this.mobile = isMobile;
    }

    public String getUa() {
        return this.ua;
    }

    public String getUserEnv() {
        return this.userEnv;
    }

    public String getDevice() {
        return this.device;
    }

    public String getDeviceType() {
        return this.deviceType;
    }

    public String getDeviceVersion() {
        return this.deviceVersion;
    }

    public String getBrowser() {
        return this.browser;
    }

    public Boolean getMobile() {
        return this.mobile;
    }

    public void setUa(final String ua) {
        this.ua = ua;
    }

    public void setUserEnv(final String userEnv) {
        this.userEnv = userEnv;
    }

    public void setDevice(final String device) {
        this.device = device;
    }

    public void setDeviceType(final String deviceType) {
        this.deviceType = deviceType;
    }

    public void setDeviceVersion(final String deviceVersion) {
        this.deviceVersion = deviceVersion;
    }

    public void setBrowser(final String browser) {
        this.browser = browser;
    }

    public void setMobile(final Boolean mobile) {
        this.mobile = mobile;
    }

    @Override
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof UserDevice)) {
            return false;
        } else {
            UserDevice other = (UserDevice)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label95: {
                    Object this$mobile = this.getMobile();
                    Object other$mobile = other.getMobile();
                    if (this$mobile == null) {
                        if (other$mobile == null) {
                            break label95;
                        }
                    } else if (this$mobile.equals(other$mobile)) {
                        break label95;
                    }

                    return false;
                }

                Object this$ua = this.getUa();
                Object other$ua = other.getUa();
                if (this$ua == null) {
                    if (other$ua != null) {
                        return false;
                    }
                } else if (!this$ua.equals(other$ua)) {
                    return false;
                }

                Object this$userEnv = this.getUserEnv();
                Object other$userEnv = other.getUserEnv();
                if (this$userEnv == null) {
                    if (other$userEnv != null) {
                        return false;
                    }
                } else if (!this$userEnv.equals(other$userEnv)) {
                    return false;
                }

                label74: {
                    Object this$device = this.getDevice();
                    Object other$device = other.getDevice();
                    if (this$device == null) {
                        if (other$device == null) {
                            break label74;
                        }
                    } else if (this$device.equals(other$device)) {
                        break label74;
                    }

                    return false;
                }

                label67: {
                    Object this$deviceType = this.getDeviceType();
                    Object other$deviceType = other.getDeviceType();
                    if (this$deviceType == null) {
                        if (other$deviceType == null) {
                            break label67;
                        }
                    } else if (this$deviceType.equals(other$deviceType)) {
                        break label67;
                    }

                    return false;
                }

                Object this$deviceVersion = this.getDeviceVersion();
                Object other$deviceVersion = other.getDeviceVersion();
                if (this$deviceVersion == null) {
                    if (other$deviceVersion != null) {
                        return false;
                    }
                } else if (!this$deviceVersion.equals(other$deviceVersion)) {
                    return false;
                }

                Object this$browser = this.getBrowser();
                Object other$browser = other.getBrowser();
                if (this$browser == null) {
                    if (other$browser != null) {
                        return false;
                    }
                } else if (!this$browser.equals(other$browser)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof UserDevice;
    }

    @Override
    public int hashCode() {
        int PRIME = 1;
        int result = 1;
        Object $mobile = this.getMobile();
        result = result * 59 + ($mobile == null ? 43 : $mobile.hashCode());
        Object $ua = this.getUa();
        result = result * 59 + ($ua == null ? 43 : $ua.hashCode());
        Object $userEnv = this.getUserEnv();
        result = result * 59 + ($userEnv == null ? 43 : $userEnv.hashCode());
        Object $device = this.getDevice();
        result = result * 59 + ($device == null ? 43 : $device.hashCode());
        Object $deviceType = this.getDeviceType();
        result = result * 59 + ($deviceType == null ? 43 : $deviceType.hashCode());
        Object $deviceVersion = this.getDeviceVersion();
        result = result * 59 + ($deviceVersion == null ? 43 : $deviceVersion.hashCode());
        Object $browser = this.getBrowser();
        result = result * 59 + ($browser == null ? 43 : $browser.hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "UserDevice(ua=" + this.getUa() + ", userEnv=" + this.getUserEnv() + ", device=" + this.getDevice() + ", deviceType=" + this.getDeviceType() + ", deviceVersion=" + this.getDeviceVersion() + ", browser=" + this.getBrowser() + ", mobile=" + this.getMobile() + ")";
    }
}
